home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Framework / Includes / UCommandHandler.h < prev    next >
Encoding:
Text File  |  1996-04-03  |  3.3 KB  |  98 lines  |  [TEXT/MPS ]

  1. // UCommandHandler.h
  2. // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. #ifndef __UCOMMANDHANDLER__
  5. #define __UCOMMANDHANDLER__
  6.  
  7. // MacApp
  8.  
  9. #ifndef __UCOMMAND__
  10. #include "UCommand.h"
  11. #endif
  12.  
  13. #ifndef __UEVENTHANDLER__
  14. #include "UEventHandler.h"
  15. #endif
  16.  
  17. //----------------------------------------------------------------------------------------
  18. // Forward and external class declarations. 
  19. //----------------------------------------------------------------------------------------
  20.  
  21.  
  22. //----------------------------------------------------------------------------------------
  23. // The parent class of applications, documents and views. 
  24. // Provides a context for undoable commands
  25. //----------------------------------------------------------------------------------------
  26.  
  27. class TCommandHandler : public TEventHandler
  28. {
  29.     MA_DECLARE_CLASS;
  30.     
  31. public:
  32.     //    TCommand*                 fLastCommand;    // the last undoable command done or undone by the
  33.     //                                            // user in the context of this command handler
  34.     
  35.     static unsigned long    fgTransactionIDCount;
  36.     
  37.     unsigned long            fPendingActionID;        
  38.                                             
  39.     //------------------------------------------------------------------------------------
  40.     // Initializer, I<Method> and Free.
  41.     //------------------------------------------------------------------------------------
  42.  
  43.     TCommandHandler();
  44.         // Constructor
  45.                 
  46.     void ICommandHandler(TEventHandler* itsNextHandler);
  47.         // Call IEventHandler
  48.     
  49.     //    virtual TObject* Clone(); // override
  50.     //        // Calls Inherited::Clone and then clones owned objects.
  51.  
  52.     virtual ~TCommandHandler();
  53.     
  54.     //------------------------------------------------------------------------------------
  55.     // MenuEvents
  56.     //------------------------------------------------------------------------------------
  57.  
  58. //        virtual void DoMenuCommand(CommandNumber aCommandNumber); // override
  59.         // Handles the Undo menu command
  60.     
  61. //        virtual void HandleSetupMenus(); // override
  62.         // Overridden to adjust the Undo menu
  63.         
  64. //        virtual void SetupUndoMenu();
  65.         // Adjusts the appearance and enabling of the Undo menu.
  66.  
  67.     //------------------------------------------------------------------------------------
  68.     // Command Handling
  69.     //------------------------------------------------------------------------------------
  70.  
  71.     virtual TCommandHandler* GetContext(CommandNumber aCommandNumber);
  72.         // A convenient way to determine the context when initializing a command posted
  73.         // by this CommandHandler. The default returns this. Overridden by TView.
  74.     
  75.     virtual void PerformCommand(TCommand* command);
  76.         // Performs the given command and its linked command by calling
  77.         // DoPerformCommand. This DOES NOT check to see if command is NULL.
  78.         
  79. //        virtual void DoPerformCommand(TCommand* command, Boolean& cmdFreed);
  80. //            // Performs the given command. Called by PerformCommand.
  81.         
  82.     virtual Boolean PerformCommandAppleEvent(TCommand* command);
  83.  
  84.     virtual TCommand* GetLastCommand();
  85.         // Returns the last undoable command. The command returned is not yet committed.
  86.     
  87.     virtual void CommitLastCommand();
  88.         // Clear any commands in the undo/redo stacks. 
  89.     
  90.     virtual void PrepareForUndoRedo(TCommand* command);
  91.         // Make this context ready for undo/redo. 
  92.     
  93.     virtual void RevealUndoRedo(TCommand* command);
  94.         // Make this context visible after undo/redo. 
  95. };
  96.  
  97. #endif // __UCOMMANDHANDLER__
  98.